<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="acc.css">
    <title>留言板</title>
</head>
<body>
   

    <div class="aaa"> 
    <?php
    $link = mysqli_connect("localhost", "root", "root", "zuoye");
    $username = $_POST['username'];
    $content = $_POST['content'];           
    $xieru =" INSERT INTO zuoye (username,content) "."VALUES('$username','$content')";
    $result = mysqli_query($link,$xieru) or die('插入失败');
    
    $chaxun ="SELECT * FROM zuoye";
    $result = mysqli_query($link,$chaxun) or die('查询失败');
    echo '<table><tr><th>'.'序号'.'</th><th>'.'用户名'.'</th><th>'.'留言内容'.'</th></tr>';
    $i=1;
    while($row = mysqli_fetch_assoc($result)){
        echo '<tr><td>'.$i. '</td>';
        echo '<td>'.$row['username']. '</td>';
        echo '<td>'.$row['content']. ' </td></tr>';
       
        $i=$i+1;
    }
    echo '</table>';
   
    
    mysqli_close($link);
    ?>
      </div>
</body>
</html>